import request from '../utils/request.js'

// 获取地址
export const getSite = () => {
	return request.get('/api/getaddress')
}

// 添加地址
export const addSite = (data) => {
	return request.post('/api/addaddress/', data)
}

// 编辑地址
export const editSite = (id,data) => {
	return request.post(`/api/updateaddress?address_id=${id}`, data)
}

// 删除地址
export const delSite = (id) => {
	return request.post(`/api/deladdress?address_id=${id}`)
}

// 获取购物车页面数据
export const getCartData = (ids) => {
	return request.get(`/api/getshopcarlist/${ids}`)
}

// 提交订单
export const commitOrder = (orderData) => {
	return request.post('/api/commitorder', orderData)
}

// 获取订单详情
export const getOrder = (order_id) => {
	return request.post(`/api/getorder?order_id=${order_id}`)
}

//  查询支付状态
export const queryPayOrder = (order_id) => {
	return request.post(`/api/queryPayOrder?order_id=${order_id}`)
}

// 取消订单
export const cancelOrder = (order_id) => {
	return request.post(`/api/cancelorder?order_id=${order_id}`)
}

// 删除订单
export const delOrder = (order_id) => {
	return request.post(`/api/delorder?order_id=${order_id}`)
}

// 支付
export const payOrder = (orderData) => {
	return request.post('/api/wxpay', orderData)
}